package com.joker.product.remote.factory;

import com.joker.common.core.domain.Result;
import com.joker.product.domain.Merchant;
import com.joker.product.domain.PmsSkuInfo;
import com.joker.product.remote.IPmsSkuInfoRemoteService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author lemon
 * @date 2024/12/29 15:07
 **/
@Component
public class PmsSkuInfoRemoteFallbackFactory implements FallbackFactory<IPmsSkuInfoRemoteService> {

    @Override
    public IPmsSkuInfoRemoteService create(Throwable cause) {
        return new IPmsSkuInfoRemoteService() {
            @Override
            public Result<PmsSkuInfo> getInfo(Long skuId) {
                return Result.error("调用失败");
            }

            @Override
            public Result<Merchant> getMerchantBySkuId(Long skuId) {
                return Result.error("调用失败");
            }

            @Override
            public Result<List<String>> getSaleAttrBySkuId(Long skuId) {
                return Result.error("调用失败");
            }
        };
    }
}
